What is @aws-crypto/ie11-detection?
@aws-crypto/ie11-detection is a utility package designed to detect the presence of Internet Explorer 11 (IE11) and its specific cryptographic capabilities. This is particularly useful for applications that need to ensure compatibility with IE11's cryptographic features or need to provide fallbacks for unsupported features.
What are @aws-crypto/ie11-detection's main functionalities?
Detect IE11
This feature allows you to detect if the current browser is Internet Explorer 11. The `isMsWindow` function checks the window object to determine if it matches IE11's characteristics.
const { isMsWindow } = require('@aws-crypto/ie11-detection');
if (isMsWindow(window)) {
console.log('This is IE11');
} else {
console.log('This is not IE11');
}
Detect SubtleCrypto
This feature checks if the SubtleCrypto interface is supported in the current browser. SubtleCrypto is a Web Crypto API that provides cryptographic primitives.
const { supportsSubtleCrypto } = require('@aws-crypto/ie11-detection');
if (supportsSubtleCrypto(window)) {
console.log('SubtleCrypto is supported');
} else {
console.log('SubtleCrypto is not supported');
}
Detect MsCrypto
This feature checks if the MsCrypto interface is supported in the current browser. MsCrypto is a legacy API specific to Internet Explorer for cryptographic operations.
const { supportsMsCrypto } = require('@aws-crypto/ie11-detection');
if (supportsMsCrypto(window)) {
console.log('MsCrypto is supported');
} else {
console.log('MsCrypto is not supported');
}
Other packages similar to @aws-crypto/ie11-detection
bowser
Bowser is a browser detection library that can identify various browsers and their versions, including Internet Explorer. Unlike @aws-crypto/ie11-detection, Bowser provides a more comprehensive detection of different browsers and their features.
detect-browser
Detect-browser is another library for detecting browser types and versions. It can identify IE11 among other browsers. While it does not specifically focus on cryptographic capabilities, it provides a broader range of browser detection functionalities compared to @aws-crypto/ie11-detection.
ua-parser-js
UA-Parser-JS is a JavaScript library to parse user-agent strings and identify browser types, versions, and operating systems. It can detect IE11 and other browsers but does not focus on cryptographic capabilities like @aws-crypto/ie11-detection.
@aws-crypto/ie11-detection
Functions for interact with IE11 browsers Crypto. The IE11 window.subtle
functions are unique.
This library is used to identify an IE11 window
and then offering types for crypto functions.
For example see @aws-crypto/random-source-browser
Usage
import {isMsWindow} from '@aws-crypto/ie11-detection'
if (isMsWindow(window)) {
// use `window.subtle.mscrypto`
}
Test
npm test